package vn.edu.saigontech.ncms.web.offering;

import java.io.File;

import vn.edu.saigontech.ncms.util.Checker;
import vn.edu.saigontech.ncms.util.IOUtil;
import vn.edu.saigontech.ncms.web.BaseAction;

@SuppressWarnings("serial")
public class TimeTableAction extends BaseAction {
	private File upload;
	private String uploadContentType;
	private String uploadFileName;
	private String fileCaption;

	public String showUpload() {
		return SUCCESS;
	}

	public String doUpload() {
		try {
			if(!Checker.isNull(this.upload)){
				File file = new File("D://myupload.txt");
				if(file.exists())
					file.delete();
				IOUtil.copy(this.upload.getAbsolutePath(), file.getAbsolutePath());
			}
		} catch (Exception e) {
			this.addActionError("loi");
		}
		return SUCCESS;
	}

	public File getUpload() {
		return upload;
	}

	public void setUpload(File upload) {
		this.upload = upload;
	}

	public String getUploadContentType() {
		return uploadContentType;
	}

	public void setUploadContentType(String uploadContentType) {
		this.uploadContentType = uploadContentType;
	}

	public String getUploadFileName() {
		return uploadFileName;
	}

	public void setUploadFileName(String uploadFileName) {
		this.uploadFileName = uploadFileName;
	}

	public String getFileCaption() {
		return fileCaption;
	}

	public void setFileCaption(String fileCaption) {
		this.fileCaption = fileCaption;
	}
}
